package com.car.controller;

import com.car.entity.Billing;
import com.car.entity.Pet_card;
import com.car.service.IAchievementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class AchievementController {
    @Autowired
    @Qualifier(value = "achievementrService")
    private IAchievementService achievementrService;

    @RequestMapping(value = "/Af")
    public String cc(Model model){


        int sum = achievementrService.findrecharge();
        model.addAttribute("sum",sum);

        int gifts=achievementrService.findgift();
        model.addAttribute("gifts",gifts);

        int card=achievementrService.findpet_card();
        model.addAttribute("card",card);

        int  cmoney=achievementrService.findmoney();
        model.addAttribute("cmoney",cmoney);

        int sunn=sum+cmoney+gifts;
        model.addAttribute("sunn",sunn);

        List<Pet_card> Pet_cardc=achievementrService.Pet_card();
        model.addAttribute("Pet_cardc",Pet_cardc);

        List<Billing>  bill=achievementrService.Bill();
        model.addAttribute("bill",bill);

        int billss = achievementrService.bills();
        model.addAttribute("bills",billss);

        return "business_Search.jsp";

}
@RequestMapping("/Af1")
public String cc1(Model model,String regtime ,String regtime1){


        String sums = achievementrService.findrecharges(regtime,regtime1);
        model.addAttribute("sum",sums);

        String giftss=achievementrService.findgifts(regtime,regtime1);
        model.addAttribute("gifts",giftss);

        String cards=achievementrService.findpet_cards(regtime,regtime1);
        model.addAttribute("card",cards);

        String  cmoneys=achievementrService.findmoneys(regtime,regtime1);
        model.addAttribute("cmoney",cmoneys);

        int sunns=Integer.parseInt(sums)+Integer.parseInt(cmoneys)+Integer.parseInt(giftss);
        model.addAttribute("sunn",sunns);

        List<Pet_card> Pet_cardcs=achievementrService.Pet_cards(regtime,regtime1);
        model.addAttribute("Pet_cardc",Pet_cardcs);

        List<Billing>  bills=achievementrService.Bills(regtime,regtime1);
        model.addAttribute("bill",bills);

        String billsss = achievementrService.billss(regtime, regtime1);
        model.addAttribute("bills",billsss);

    return "business_Search.jsp";
}

}